﻿using System;

namespace diantou.dataModel
{
    /// <summary>
    /// 问题
    /// </summary>
    [fastCSharp.emit.jsonSerialize(IsAllMember = true)]
    [fastCSharp.emit.jsonParse(IsAllMember = true)]
    [fastCSharp.emit.dataSerialize(IsReferenceMember = false)]
    [fastCSharp.code.cSharp.webView.clientType(Name = "diantou.question")]
    [fastCSharp.code.cSharp.sqlModel(LogTcpCallService = "DataLog")]
    public partial class question
    {
        /// <summary>
        /// 最大标题长度
        /// </summary>
        public const int MaxTitleLength = 80;
        /// <summary>
        /// 问题标识
        /// </summary>
        [fastCSharp.code.cSharp.webView.outputAjax]
        public int Id;
        /// <summary>
        /// 标题
        /// </summary>
        [fastCSharp.emit.dataMember(MaxStringLength = MaxTitleLength)]
        public string Title;
        /// <summary>
        /// 浏览次数
        /// </summary>
        public int BrowseCount;
        /// <summary>
        /// 评论数
        /// </summary>
        public int CommentCount;
        /// <summary>
        /// 被邀请用户数量
        /// </summary>
        public int InviteCount;
        /// <summary>
        /// 最后回复时间
        /// </summary>
        public DateTime LastAnswerTime = fastCSharp.date.NowSecond;
        /// <summary>
        /// 最后修改时间
        /// </summary>
        public DateTime LastReworkTime = fastCSharp.date.NowSecond;
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime = fastCSharp.date.NowSecond;
        /// <summary>
        /// 发散讨论问题回答的可用分
        /// </summary>
        public int CreditPoint;
        /// <summary>
        /// 修改问题理由
        /// </summary>
        public sealed class reworkReason : Attribute
        {
            /// <summary>
            /// 理由
            /// </summary>
            public string Remark;
        }
        /// <summary>
        /// 修改问题理由类型
        /// </summary>
        public enum reworkReasonType : byte
        {
            None,
            /// <summary>
            /// 问题不清晰，需补充完善
            /// </summary>
            [reworkReason(Remark = "问题不清晰，需补充完善")]
            Perfect,
            /// <summary>
            /// 改一下文字、标点、空格
            /// </summary>
            [reworkReason(Remark = "改一下文字、标点、空格")]
            Punctuation,
            /// <summary>
            /// 精简一下
            /// </summary>
            [reworkReason(Remark = "精简一下")]
            Simplify,
            /// <summary>
            /// 不想解释
            /// </summary>
            [reworkReason(Remark = "不想解释")]
            NotExplain,
        }
        /// <summary>
        /// 修改问题理由
        /// </summary>
        [fastCSharp.emit.dataMember(DataType = typeof(byte))]
        public reworkReasonType Reason;
        /// <summary>
        /// 锁定标识
        /// </summary>
        public bool IsLock;
        /// <summary>
        /// 创建者用户标识
        /// </summary>
        //[fastCSharp.emit.jsonSerialize.member(IsIgnoreCurrent = true)]
        [fastCSharp.code.cSharp.webView.outputAjax(IsIgnoreCurrent = true)]
        public int UserId;
        /// <summary>
        /// 重定向问题标识
        /// </summary>
        [fastCSharp.code.cSharp.webView.outputAjax]
        public int LinkId;
        /// <summary>
        /// 回答者用户标识
        /// </summary>
        public int AnswerUserId;
        /// <summary>
        /// 最后修改标题的用户标识
        /// </summary>
        public int ReworkTitleUserId;
        /// <summary>
        /// 最后修改描述的用户标识
        /// </summary>
        public int ReworkRemarkUserId;
        /// <summary>
        /// 最后修改重定向的用户标识
        /// </summary>
        public int ReworkLinkUserId;

        /// <summary>
        /// 问题描述
        /// </summary>
        [fastCSharp.emit.dataMember(Group = 1, MaxStringLength = 256 << 10)]
        public string Remark = string.Empty;

        #region 计算列
        /// <summary>
        /// 最后答案标识
        /// </summary>
        [fastCSharp.emit.dataMember(IsIgnoreCurrent = true, IsSqlStream = true)]
        public int LastAnswerId;
        /// <summary>
        /// 重定向问题数量
        /// </summary>
        [fastCSharp.emit.dataMember(IsIgnoreCurrent = true, IsSqlStream = true)]
        public int LinkCount;
        /// <summary>
        /// 回答数量
        /// </summary>
        [fastCSharp.emit.dataMember(IsIgnoreCurrent = true, IsSqlStream = true)]
        public int AnswerCount;
        /// <summary>
        /// 关注者数量
        /// </summary>
        [fastCSharp.emit.dataMember(IsIgnoreCurrent = true, IsSqlStream = true)]
        public int FocusCount;
        /// <summary>
        /// 最佳答案标识
        /// </summary>
        [fastCSharp.emit.dataMember(IsIgnoreCurrent = true, IsSqlStream = true)]
        public int BestAnswerId;
        /// <summary>
        /// 话题数量
        /// </summary>
        [fastCSharp.emit.dataMember(IsIgnoreCurrent = true, IsSqlStream = true)]
        public int TopicCount;
        /// <summary>
        /// 收藏次数
        /// </summary>
        [fastCSharp.emit.dataMember(IsIgnoreCurrent = true, IsSqlStream = true)]
        public int FavoriteCount;
        /// <summary>
        /// OJ问题标识
        /// </summary>
        [fastCSharp.emit.dataMember(IsIgnoreCurrent = true, IsSqlStream = true)]
        public int ProblemId;
        #endregion
    }
}
